0840d594ac50ffbc7cd2f4b8faaad4098d03595a,src/main/java/edu/princeton/cs/algs4/StdAudio.java,StdAudio,readByte,#String#,208
Before Change
File file = new File(filename);
if (file.exists()) {
ais = AudioSystem.getAudioInputStream(file);
data = new byte[ais.available()];
ais.read(data);
}
// try to read from URL
After Change
File file = new File(filename);
if (file.exists()) {
ais = AudioSystem.getAudioInputStream(file);
int bytesToRead = ais.available();
data = new byte[bytesToRead];
int bytesRead = ais.read(data);
if (bytesToRead != bytesRead) throw new RuntimeException("read only " + bytesRead + " of " + bytesToRead + " bytes");
}
// try to read from URL